package com.per.mybootall.designMode.agencyModel.dynamicModel;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: yyy
 * Date: 2022/1/18
 * Time: 13:39
 * Description:
 */
public class DynamicProxy implements InvocationHandler {

  private Object object;
  public DynamicProxy(Object obj){
    this.object=obj;
  }

  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    System.out.println("before");
    Object result = method.invoke(object, args);
    System.out.println("after");
    return result;
  }
}
